<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="security"
	uri="http://www.springframework.org/security/tags"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><tiles:insertAttribute name="title" /></title>
<link rel="stylesheet" href="<c:url value="css/bootstrap.min.css" />"
	type="text/css" />
<link rel="stylesheet"
	href="<c:url value="font-awesome/css/font-awesome.min.css" />"
	type="text/css" />
<link rel="stylesheet" href="<c:url value="css/local.css" />"
	type="text/css" />
<link rel="stylesheet"
	href="<c:url value="css/jquery.dataTables.css" />" type="text/css" />

<script src="<c:url value="js/jquery-1.10.2.min.js" />"
	type="text/javascript"></script>
<script src="<c:url value="js/bootstrap.min.js" />"
	type="text/javascript"></script>
<script src="<c:url value="js/jquery.dataTables.js" />"
	type="text/javascript"></script>
</head>
<body>
	<div id="wrapper">
		<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
			<div class="navbar-header">
				<button type="button" class="navbar-toggle" data-toggle="collapse"
					data-target=".navbar-ex1-collapse">
					<span class="sr-only">Toggle navigation</span> <span
						class="icon-bar"></span> <span class="icon-bar"></span> <span
						class="icon-bar"></span>
				</button>
				<a class="navbar-brand" href="home">CSC Project</a>
			</div>
			<div class="collapse navbar-collapse navbar-ex1-collapse">
				<ul class="nav navbar-nav side-nav">
					<security:authorize access="hasAnyRole('ROLE_USER')">
						<li><a href="viewProfile"><i class="fa fa-user"></i> View Profile</a></li>
					</security:authorize>
					
					<security:authorize access="hasAnyRole('ROLE_ADMIN', 'ROLE_USER')">
						<li><a href="viewAccount"><i class="fa fa-credit-card"></i> View Account</a></li>
						<li><a href="viewTransaction"><i class="fa fa-exchange"></i> Transaction</a></li>
						<li><a href="viewLog"><i class="fa fa-tasks"></i> View Log</a></li>
					</security:authorize>
					
					<security:authorize access="hasAnyRole('ROLE_ADMIN')">
						<li><a href="adminViewCreateUser"><i class="fa fa-tasks"></i> Create User</a></li>
						<li><a href="adminViewChangeUserState"><i class="fa fa-tasks"></i> Change User State</a></li>
					</security:authorize>
					<li><a href="#"><i class="fa fa-tasks"></i> About us</a></li>
				</ul>
				
				<ul class="nav navbar-nav navbar-right navbar-user">
					<security:authorize access="isAnonymous()">
						<li class="dropdown messages-dropdown">
							<a href="login" id="login-link">Login</a>
						</li>
					</security:authorize>
					<security:authorize access="isAuthenticated()">
						<li class="dropdown user-dropdown">
							<a href="#" class="dropdown-toggle" data-toggle="dropdown">
								<i class="fa fa-user"></i>
								<security:authentication property="principal.username"/>
								<b class="caret"></b>
							</a>
							<ul class="dropdown-menu">
								<li class="divider"></li>
								<li>
									<a href="<c:url value="/j_spring_security_logout"/>">
										<i class="fa fa-power-off"></i>Log Out
									</a>
								</li>
							</ul>
						</li>
					</security:authorize>
				</ul>
			</div>
		</nav>
		<div id="page-wrapper">
			<c:if test="${not empty successMessage}">
				<div class="alert alert-success" role="alert">${successMessage}</div>
			</c:if>
			<c:if test="${not empty errorMessage}">
				<div class="alert alert-warning" role="alert">${errorMessage}</div>
			</c:if>
			<tiles:insertAttribute name="body" />
		</div>		
	</div>
</body>
</html>